import 'dart:async';

import 'package:hockey/jzx_apps.dart';
import 'package:hockey/pages/jzx_login/jzx_login.dart';

class JzxIntrSilderController extends GetxController {
  final intrList = [
    IntrItem(
        'Here, ',
        "hockey is more than just a sport, it's a passionate community. ",
        Assets.images.icLine1),
    IntrItem(
        'Communicate ',
        "and share experiences with hockey fans from all over the world.",
        Assets.images.icLine2),
    IntrItem(
        'Come join ',
        "the community and embark on a journey to healthier exercise together!",
        Assets.images.icLine3),
  ];

  /// 标记是否自动切换
  var index = 0;
  Timer? timer;

  jumpTo() {
    timer = Timer.periodic(const Duration(seconds: 2), (timer) {
      cancel();
      if (index == 2) {
        // login
        Get.offAllNamed(kRouteJzxLogin);
      }
    });
  }

  cancel() {
    timer?.cancel();
    timer = null;
  }
}

class IntrItem {
  final String title;
  final String content;
  final AssetGenImage image;

  IntrItem(this.title, this.content, this.image);
}
